package com.xlh.dao.user.helper;

import cn.hutool.core.collection.CollectionUtil;
import com.xlh.dao.user.ClassMapper;
import com.xlh.pojo.user.Class;
import com.xlh.pojo.user.ClassExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author cfz
 */
@Repository
public class ClassMapperHelper {

    @Autowired
    private ClassMapper classMapper;

    /**
     * 获取对象
     * @param classId
     * @return
     */
    public Class get(Long classId){

        ClassExample example = new ClassExample();
        example.createCriteria().andDeletedEqualTo(false).andIdEqualTo(classId);
        List<Class> classes = classMapper.selectByExample(example);
        if(CollectionUtil.isNotEmpty(classes)){
            return classes.get(0);
        }
        return null;
    }




}
